/**
 * 路由配置
 * Created by freeman on 16-6-26.
 */

import index from './components/Home/index.vue'
import Search from './components/Search/index.vue'
import Login from './components/Login/index.vue'
import Register from './components/Register/index.vue'
import NotFount from './components/NotFound.vue'
import ArticleIndex from './components/Article/index.vue'
import Writer from './components/Writer/index.vue'
import WriterEdit from './components/Writer/edit.vue'
import Mine from './components/Mine/index.vue' 
export default function (router) {
    router.map({
        '/':{
            component:index,
        },
        '/search':{
            component:Search,
        },
        '/article/:id':{
            name:'article',
            component:ArticleIndex,
        },
        '/login':{
            component:Login,
        },
        '/sign_up':{
            component:Register,
        },
        '/writer':{
            component:Writer,
        },
        '/writer/:id':{
            name:'writerEdit',
            component:WriterEdit,
        },
        '/mine':{
            component:Mine,
            subRoutes: {
                '/': {
                    // 当匹配到 /mine 时，这个组件会被渲染到 Mine 组件的 <router-view> 中。
                    // 为了简便，这里使用了一个组件的定义
                    component: {
                        template: '<p>Default sub view for mine</p>'
                    }
                },
                // matches "/mine/profile"
                'profile': {
                    name:'profile',
                    component: require('./components/Mine/profile.vue')
                },
                // matches "/mine/posts"
                'posts': {
                    name:'posts',
                    component: require('./components/Mine/posts.vue')
                }
            }
        },
        "*":{
            component:NotFount
        }
    });
}